package Tests;

//TOKENIZER EXAMPLE
//Frans Coenen, Monday 15 January 1999
//Department of Computer Science, The University of Liverpool, UK

import java.io.*; 
import java.util.*;

class TokenizerExample
 {
 // Create BufferedReader class instance

 static InputStreamReader input = new InputStreamReader(System.in);
 static BufferedReader    keyboardInput = new BufferedReader(input);

 /* Main method  */

 public static void main(String[] args) throws IOException
     {
	int numberOfTokens=0;
	
	// Get a string
	
     System.out.println("Input a string ");
	StringTokenizer data = new StringTokenizer(keyboardInput.readLine());

	// Output number of tokens in the line
	
	numberOfTokens = data.countTokens();
	System.out.println("Number of tokens = " + numberOfTokens + "\n");
	
	// Output tokens
	
	for (int counter=0; counter < numberOfTokens; counter++) { 
	    System.out.println(data.nextToken());
	    }	
	}
}    

